int clearscreen()
{
 asm{
 mov ax,3
 int 0x10
 mov bx,0
 mov ah,0x02
 mov dl,10
 mov dh,30
 int 0x10
 }
return 0;
}

char wait_key()
{
 char ich;
 asm{
 mov ax,0
 int 0x16
 mov ich,al
 }
return ich;
}

int putc(char c,int cur)
{
 asm{
 mov ax,0xb800
 mov es,ax
 mov di,cur
 mov al,c
 mov es:[di],al
 }
cur=cur+2;
return cur;
}

int putstring(char *buffer,int cur)
{
 char send_chr;
 asm{
 mov si,buffer
 }
 do
 {
  asm{
  lodsb
  mov send_chr,al
  }
  cur=putc(send_chr,cur);
 }
 while(send_chr!=0);
return cur;
}

int endl(int cur)
{
 int cnt;
 for(cnt=0;cnt<3840;cnt=cnt+160)
 {
  if(cur<cnt)
  {
   cur=cnt;
   return cur;
  }
 }
}

char getport(int port)
{
 char c;
 asm{
 mov dx,port
 in al,dx
 mov c,al
 }
return c;
}

int main()
{
 clearscreen();
 int cursor=0;
 char ich=0;
 char *welc="Welcome to C operating system!";
 char *salil="By Salil Bhagurkar!";
 cursor=putstring(welc,cursor);
 cursor=endl(cursor);
 cursor=putstring(salil,cursor);
 wait_key();
 return 0;
}